package cn.school.test;

import cn.school.dao.SubjectMapper;
import cn.school.entity.Subject;
import cn.school.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class AddDemo {
    public static void main(String[] args) {
        SqlSession session = MybatisUtil.get(false);
        Subject subject=new Subject(6,"21天精通java",21);
        SubjectMapper mapper = session.getMapper(SubjectMapper.class);
        int add = mapper.add(subject);
        System.out.println(add+"加入了,新课程的主键是 "+subject.getId());
        MybatisUtil.close(session);
    }
}
